﻿CREATE TABLE [dbo].[HospCard](
	[Id] BIGINT IDENTITY(1,1) NOT NULL,
	[WxUserId] BIGINT NULL,
	[BkMemberId] BIGINT NULL,
	[CardType] [int] NULL,
	[CardNo] NVARCHAR(50) NOT NULL,
	[PatientName] [nvarchar](50) NULL,
	[PatientId] NVARCHAR(50) NULL, 
    [InDeptNo] NVARCHAR(50) NULL, 
    [Name] NVARCHAR(50) NULL, 
    [Gender] NVARCHAR(50) NULL, 
    [Age] NVARCHAR(50) NULL, 
    [Birthdate] NVARCHAR(50) NULL, 
    [IdenNo] NVARCHAR(50) NULL, 
    [Phone] NVARCHAR(50) NULL, 
    [FeeType] NVARCHAR(50) NULL, 
    [IsDefault] INT NULL DEFAULT 0, 
	[RecStatus] INT NOT NULL, 
    [RecCreateDt] DATETIME NOT NULL, 
    [RecUpdateDt] DATETIME NULL, 
    [RecDeleteDt] DATETIME NULL,
    CONSTRAINT [PK_HospCard] PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'就诊卡Id，自增列，主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HospCard', @level2type=N'COLUMN',@level2name='Id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'微信用户Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HospCard', @level2type=N'COLUMN',@level2name='WxUserId'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'就诊卡类型：0诊疗卡 1健康卡 2市民卡' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HospCard', @level2type=N'COLUMN',@level2name=N'CardType'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'就诊卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HospCard', @level2type=N'COLUMN',@level2name=N'CardNo'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'患者姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HospCard', @level2type=N'COLUMN',@level2name=N'PatientName'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'就诊卡' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HospCard'
GO

EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者标识',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'PatientId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'住院号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'InDeptNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者名称',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'Name'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者性别',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'Gender'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者年龄',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'Age'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者出生日期 yyyy-MM-dd',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'Birthdate'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者身份证号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'IdenNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者联系电话',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'Phone'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'患者费别 自费或者公费',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'FeeType'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'是否默认就诊卡； 1-默认，0-非默认',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'IsDefault'

GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'倍康会员Id',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'BkMemberId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'记录创建时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'RecCreateDt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'记录状态, 1：正常；2：删除',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'RecStatus'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'记录上次修改时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'RecUpdateDt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'记录删除时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'HospCard',
    @level2type = N'COLUMN',
    @level2name = N'RecDeleteDt'